//
//  MessageDto.m
//  XMDLearn
//
//  Created by apple on 16/4/12.
//  Copyright © 2016年 hao. All rights reserved.
//

#import "MessageDto.h"

@implementation MessageDto

- (BOOL) isSuceess
{
    if ([self.code isEqualToString:@"10001"]) {
        return YES;
    }
    else
    {
        return NO;
    }
}

- (NSString*) getCode
{
    return self.code;
}

- (id) getContent
{
    NSError* error;
    NSData* data = [self.content dataUsingEncoding:NSUTF8StringEncoding];
    id jsonObject = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];//解析json字符串
    return jsonObject;
    
//    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic
//                                                       options:NSJSONWritingPrettyPrinted
//                                                         error:&error];
//    
//    NSString *jsonString = [[NSString alloc] initWithData:jsonData
//                                                 encoding:NSUTF8StringEncoding];
//    
//    return jsonString;

}

- (NSString*) getMessage
{
    if(self.message == nil || self.message.length == 0)
    {
        return self.content;
    }
    else
    {
        return self.message ;
    }
}


@end
